/* 
 * File:   RandomGenerator.cpp
 * Author: fibrizo
 * 
 * Created on 6 de junio de 2014, 20:40
 */

#include "RandomGenerator.h"
#include <cstdlib>
#include <iostream>
#include <chrono>
#include <string>
#include <ctime>
#include <ratio>
#include <sstream>
#include <vector>

using std::vector;
using namespace std::chrono;
using std::cout;
using std::endl;
using std::stringstream;
using std::string;
using std::stoi;

RandomGenerator::RandomGenerator() {
}

int RandomGenerator::generate(int min, int max) {
	high_resolution_clock::time_point t1 = high_resolution_clock::now();
        vector<string>* perdedorDeTiempo = new vector<string>();
        delete perdedorDeTiempo;
	high_resolution_clock::time_point t2 = high_resolution_clock::now();
	duration<double> time_span = duration_cast<duration<double>>(t2 - t1);
	stringstream ss;
	ss << time_span.count();
	string s;
	s = ss.str();
        stringstream sss;
	sss << s[7];
        int randomNumber = stoi((sss.str()), NULL, 10);
	return (min + randomNumber % (max - min + 1));
    
}

RandomGenerator::RandomGenerator(const RandomGenerator& orig) {
}

RandomGenerator::~RandomGenerator() {
}

